﻿using BySoft.Server.Common.Entity;
using BySoft.Server.DataAccess;
using BySoft.Server.DataAccess.UserCode;
using OneSoft.DataAccess;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;

namespace BySoft.Server.Business.UserCode
{
    public partial class BsHalfTransferBusiness
    {
        public static DataTable SelectDialogScheduleDetailList(string BillDate, string strWorkOrderNo, string strScheduleID, string strProductID, string strProductName, int pageIndex, int pageSize, out int m_count)
        {
            return BsHalfTransferDataAccess.SelectDialogScheduleDetailList(BillDate, strWorkOrderNo, strScheduleID, strProductID, strProductName, pageIndex, pageSize, out m_count);
        }

        public static void SaveOrUpdate(BsHalftransferEntity Entity, string strType)
        {
            using (DataAccessBroker broker = DataAccessFactory.Instance())
            {
                broker.BeginTransaction();
                try
                {
                    if (strType == "Save")
                    {
                        DataAccessCommon.Insert(Entity, broker);
                    }
                    else
                    {
                        DataAccessCommon.UpdateOnly(Entity, broker);
                    }
                    broker.Commit();
                }
                catch
                {
                    broker.Rollback();
                    throw;
                }
            }
        }

        public static void Del(string strCode)
        {
            using (DataAccessBroker broker = DataAccessFactory.Instance())
            {
                try
                {
                    broker.BeginTransaction();
                    ClsCommDA.Del("BS_HalfTransfer", "HalfTransferID", strCode, broker);
                    broker.Commit();
                }
                catch
                {
                    broker.Rollback();
                    throw;
                }
            }
        }

        public static DataTable SelectList(string HalfTransferID, string strFrom, string strTo, int IHalfTransferCount, out int icurPageIndex, int pageIndex, int PageSize, out int m_count)
        {
            return BsHalfTransferDataAccess.SelectList(HalfTransferID, strFrom, strTo, IHalfTransferCount, out icurPageIndex, pageIndex, PageSize, out m_count);
        }
    }
}
